package team.epos.merchant.servlet;

import team.epos.merchant.dto.ResponseBody;
import team.epos.merchant.service.RegisterService;
import team.epos.merchant.service.RegitsterServiceImpl;
import team.epos.utils.annotation.RequestMethod;
import team.epos.utils.pojo.MUser;
import team.epos.utils.servlet.BaseServlet;
import team.epos.utils.util.JsonUtil;
import team.epos.utils.util.PojoParamUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author CHENKI
 */
public class RegisterServlet extends BaseServlet {
    private RegisterService registerService = new RegitsterServiceImpl();

    @RequestMethod(method = "register")
    public void register(HttpServletRequest req, HttpServletResponse resp) {
        MUser user = PojoParamUtil.getObject(req, MUser.class);
        int i = registerService.addUser(user);
        try {
            resp.getWriter().write(String.valueOf(i));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
